/**
 * @ProjectName:exam
 * @FileName: AssignBusRecord.java
 * @PackageName: edu.xpu.project.record.entity
 * @Company:北京有生博大软件有限公司（西安分公司）
 * @Copyright (c) 2017,RiseSoft  All Rights Reserved.
 * @date 2017年4月29日 下午5:47:21
 */
package edu.xpu.project.record.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import edu.xpu.project.vehicle.entity.BusSchedule;
import edu.xpu.project.vehicle.entity.SchoolBus;

/**
 * @ClassName: AssignBusRecord.java
 * @Description: 车辆派遣记录
 * 			车次--车辆关系 记录
 *
 * @author liukang
 * @date 2017年4月29日 下午5:47:21
 * @version 
 * @since JDK 1.6
 */
@Entity(name="AssignBusRecord")
@Table(name="ASSIGN_BUSRECORD")
public class AssignBusRecord implements Serializable {

	private static final long serialVersionUID = 4806587632600315357L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	
	
	@OneToOne(optional=true)
	@JoinColumn(name="bus_schedule_id")
	private BusSchedule busSchedule;
	
	/*
	 * 当前状态
	 * 1: 未发车
	 * 2: 已发车
	 * 3: 发车完成
	 * 4: 已删除
	 */
	private Integer status;

	/*------- 一个指派下有多个校车 --------*/
	/*
	 * 使用[,]隔开
	 */
	private String schoolBusIds;
	//@OneToMany(mappedBy="assignBusRecord")
	//public Set<SchoolBus> buses;
	@Transient
	private Integer busNum;
	
	@Transient
	private List<SchoolBus> schoolBus;
	
	private Date createDate;
	
	private Long createPersonId;
	private String createPersonName;
	private Date assignDate;


	public Date getAssignDate() {
		return assignDate;
	}
	
	public void setAssignDate(Date assignDate) {
		this.assignDate = assignDate;
	}
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public BusSchedule getBusSchedule() {
		return busSchedule;
	}
	public void setBusSchedule(BusSchedule busSchedule) {
		this.busSchedule = busSchedule;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Long getCreatePersonId() {
		return createPersonId;
	}
	public void setCreatePersonId(Long createPersonId) {
		this.createPersonId = createPersonId;
	}
	public String getCreatePersonName() {
		return createPersonName;
	}
	public void setCreatePersonName(String createPersonName) {
		this.createPersonName = createPersonName;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	/*public Set<SchoolBus> getBuses() {
		return buses;
	}
	public void setBuses(Set<SchoolBus> buses) {
		this.buses = buses;
	}*/
	public String getSchoolBusIds() {
		return schoolBusIds;
	}
	public void setSchoolBusIds(String schoolBusIds) {
		this.schoolBusIds = schoolBusIds;
	}
	public List<SchoolBus> getSchoolBus() {
		return schoolBus;
	}
	public void setSchoolBus(List<SchoolBus> schoolBus) {
		this.schoolBus = schoolBus;
	}
	public Integer getBusNum() {
		String schoolBusIds2 = getSchoolBusIds();
		String[] split = schoolBusIds2.split(",");
		return split.length;
	}
	public void setBusNum(Integer busNum) {
		this.busNum = busNum;
	}
	
}

